//
//  JPMPersonM.swift
//
//  Created by 邱仙凯 on 2022/4/11
//  Copyright (c) . All rights reserved.
//

import Foundation
import ObjectMapper

public struct JPMPersonM: Mappable {

  // MARK: Declaration for string constants to be used to decode and also serialize.
  private struct SerializationKeys {
    static let cMobiletel = "c_mobiletel"
    static let orgName = "org_name"
    static let rowNum = "row_num"
    static let idKey = "id_key"
    static let cUnitname = "c_unitname"
    static let cName = "c_name"
  }

  // MARK: Properties
  public var cMobiletel: String?
  public var orgName: String?
  public var rowNum: Int?
  public var idKey: String?
  public var cUnitname: String?
  public var cName: String?

  // MARK: ObjectMapper Initializers
  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public init?(map: Map){

  }

  /// Map a JSON object to this class using ObjectMapper.
  ///
  /// - parameter map: A mapping from ObjectMapper.
  public mutating func mapping(map: Map) {
    cMobiletel <- map[SerializationKeys.cMobiletel]
    orgName <- map[SerializationKeys.orgName]
    rowNum <- map[SerializationKeys.rowNum]
    idKey <- (map[SerializationKeys.idKey],StringTransform())
    cUnitname <- map[SerializationKeys.cUnitname]
    cName <- map[SerializationKeys.cName]
  }

  /// Generates description of the object in the form of a NSDictionary.
  ///
  /// - returns: A Key value pair containing all valid values in the object.
  public func dictionaryRepresentation() -> [String: Any] {
    var dictionary: [String: Any] = [:]
    if let value = cMobiletel { dictionary[SerializationKeys.cMobiletel] = value }
    if let value = orgName { dictionary[SerializationKeys.orgName] = value }
    if let value = rowNum { dictionary[SerializationKeys.rowNum] = value }
    if let value = idKey { dictionary[SerializationKeys.idKey] = value }
    if let value = cUnitname { dictionary[SerializationKeys.cUnitname] = value }
    if let value = cName { dictionary[SerializationKeys.cName] = value }
    return dictionary
  }

}
